<div id="page-wrapper">
	<div class="row">
		<div class="col-lg-12">
			<h3 class="page-header">
				<span>评论</span>
			</h3>
		</div>
		<!-- /.col-lg-12 -->
	</div>
	<!-- /.row -->

	<div class="row">
		<div class="col-lg-12">
			<div class="panel panel-default">
				<div class="panel-heading">

				</div>
				<!-- /.panel-heading -->
				<div class="panel-body">
					<div class="table-responsive">
						<table class="table table-bordered">
							<thead>
								<tr>
									<!--<th><input type="checkbox" data-action="checkboxAll"></th>-->
									<th width="60%">评论内容</th>
									<th width="10%">状态</th>
									<th>操作</th>
								</tr>
							</thead>
							<tbody>
								<foreach name='datas' item='data' >
									<tr>
										<!--<td><input type="checkbox" data-action="checkboxOnce" name="praises[]" value="{$data['id']}" form="praiseOpera"></td>-->
										<td>{$data['content']}</td>
										<td><?php if($data['status'] == 1){
											echo "正常";
										}else{
											echo "待审核";
										}?></td>
										<td>
											<button type="button" onclick="item_through({$data['id']})" class="btn btn-success">通过</button>
											<button type="button" onclick="item_delete({$data['id']})" class="btn btn-danger">删除</button>
										</td>
									</tr>
								</foreach>
							</tbody> 
						</table>
					</div>
					<!-- /.table-responsive -->
				</div>
				<!-- /.panel-body -->
			</div>
			<!-- /.panel -->
		</div>
		<!-- /.col-lg-6 -->
	</div>
	<nav>
		<ul class="pagination">
			<php>
				$uri = $_SERVER['REQUEST_URI'];
				$str_p = strpos( $uri, 'page' );
				$str_q = false;
				if( $str_p != false ){
					//$str_q = strpos( $uri, "&", $str_p );
					$str_q = strlen($uri);
				}
				if( $str_p != false && $str_q != false ){
					$uri = substr_replace( $uri, "", $str_p, $str_q - $str_p );
				}
				$str_p = strrpos( $uri, "?" );
				if( $str_p == strlen($uri) - 1 ){
					$uri = substr_replace( $uri, "", $str_p, 1 );
				}
				$str_p = strrpos( $uri, "&" );
				if( $str_p == strlen($uri) - 1 ){
					$uri = substr_replace( $uri, "", $str_p, 1 );
				}
			</php>
			<if condition="$page['pre'] gt 0 ">
				<li>
					<a href="{:implode(array( $uri, '&', 'page', '=', $page['pre']) )}" aria-label="Previous">
						<span aria-hidden="true">&laquo;</span>
					</a>
				</li>
			</if>
			<for start="1" end=":intval( $page['count'] ) ">
				<li class="{$page['curren']==$i ? 'active':''}"><a href="{:implode(array( $uri, '&', 'page', '=', $i) )}">{$i}</a></li>
			</for>
			<if condition="$page['next'] lt ( $page['count'] )">
				<li>
					<a href="{:implode(array( $uri, '&', 'page', '=', $page['next']) )}" aria-label="Next">
						<span aria-hidden="true">&raquo;</span>
					</a>
				</li>
			</if>
		</ul>
	</nav>
	<!-- /.row -->
</div>
<!-- /#page-wrapper -->
<import type="js" file="common" basepath="/Public/js" />
<script type="text/javascript">
//	common.multiSelect.init( "checkboxAll", "checkboxOnce" );
function item_delete(id){
    $.ajax({
        url:'/User/praiseeat/comment_delete',
        data:{item_id:id},
        type:'get',
        success:function(res){
            window.location.reload();
        }
    });
}
function item_through(id){
    var total_id = <?php echo I("get.item_id", -1, '');?>;
    $.ajax({
        url:'/User/praiseeat/comment_through',
        data:{
            item_id:id,
			id:total_id
		},
        type:'get',
        success:function(res){
            window.location.reload();
        }
    });
}
</script>
